package com.cxc.java8;

import java.text.DecimalFormat;
import java.util.function.Function;

class MyMoney{
   private int money;
   public MyMoney(int money){
       this.money = money;
   }
  public void printMoney(Function<Integer,String> function){
      System.out.println("我的存款：" +function.apply(this.money));
  }
}

public class FunctionTest {
    public static void main(String[] args) {
       MyMoney me  = new MyMoney(88888888);
       Function<Integer,String> result = i -> new DecimalFormat("#,###").format(i);
       me.printMoney(result);
    }
}
